package com.population.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.mis.dao.RoleMapper;
import com.mis.dao.UserMapper;
import com.mis.entity.Role;
import com.mis.entity.Account;
import com.population.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Title
 * @Author shmily
 * @Date 2019/9/26
 */

@Slf4j
@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserMapper userMapper;

    @Autowired
    private RoleMapper roleMapper;

    @Override
    public Account getUserByUserName(String username) {
        QueryWrapper<Account> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("username",username);
        return userMapper.selectOne(queryWrapper);
    }

    @Override
    public Role getUserRole(Integer roleId) {
        return roleMapper.selectById(roleId);
    }
}
